<?php
	require 'lib/mysql.php';

	$origin = 'select csname, opscore, discipscore, dityscore, rdate, addition from v_dedution where sid=?';

	if(!mysqli_stmt_prepare($mysqli_stmt, $origin)) {
		die('Statement Preparation Fail, Error: (' . mysqli_stmt_errno($mysqli_stmt) . ')' . mysqli_stmt_error($mysqli_stmt));
	}

	if(!mysqli_stmt_bind_param($mysqli_stmt, 's', $sid)) {
		die('Statement Bind Param Fail, Error: (' . mysqli_stmt_errno($mysqli_stmt) . ')' . mysqli_stmt_error($mysqli_stmt));
	}

	$sid = $_SESSION['sid'];;

	if(!mysqli_stmt_execute($mysqli_stmt)) {
		die('Statement Execution Fail, Error: (' . mysqli_stmt_errno($mysqli_stmt) . ')' . mysqli_stmt_error($mysqli_stmt)); 
	}

	if(!mysqli_stmt_bind_result($mysqli_stmt, $csname, $opscore, $discipscore, $dityscore, $rdate, $addition)) {
		die('Statement Result Binding Fail, Error: (' . mysqli_stmt_errno($mysqli_stmt) . ')' . mysqli_stmt_error($mysqli_stmt));
	}

	if(!mysqli_stmt_store_result($mysqli_stmt)) {
		die('Statement Storing Result Fail, Error: (' . mysqli_stmt_errno($mysqli_stmt) . ')' . mysqli_stmt_error($mysqli_stmt));
	}

	while(mysqli_stmt_fetch($mysqli_stmt)) {
?>

	<div class="item">
		<span style="width: 300px"><?= $csname ?></span>
		<span style="width: 100px"><?= $opscore ?></span>
		<span style="width: 100px"><?= $discipscore ?></span>
		<span style="width: 100px"><?= $dityscore ?></span>
		<span style="width: 100px"><?= $rdate ?></span>
		<span style="width: 360px"><?= $addition ?></span>
	</div>

<?php
	}

	mysqli_stmt_close($mysqli_stmt);
	mysqli_close($mysqli);
?>
